	function choice(arr){
var larr = arr.length;
var 	rand = Math.random()*larr;
	return arr[Math.floor(rand)];
}

function inShift(a,effect,bounding){
var lbound = bounding["low"];
	var hbound = bounding["high"];
	var delta = effect*Math.random();
var alcut = a-lbound;
	var ahcut = hbound-a;
	console.log(delta,alcut,ahcut,effect);
	if( alcut< effect){
console.log("hippo");
		a = a+delta}
	else if (ahcut < effect){ 
console.log("elephant");
		a = a-delta}
	else {  
console.log("computer");
		var thisChoice = choice([-1,1]);
		console.log("thisChoice",thisChoice);
		a = a+delta*thisChoice}
	return a;
}

function colorShift(tc,effect,bounding){
return [inShift(tc[0],effect,bounding),inShift(tc[1],effect,bounding),inShift(tc[2],effect,bounding)]};

var globalColor = [0,1,0];
setInterval(()=>{
	var thisColor = globalColor;
		globalColor = colorShift(thisColor,0.03,{"low":0.5,"high":1});
	console.log("this color",globalColor);
//		state[0].tailColor= globalColor;
	},10);
